﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>微街秀 >公众号二维码</title>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no" />
    <link href="css/base.css" rel="stylesheet" type="text/css" />
    <link href="plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="plugins/bootstrap-fileinput-master/css/fileinput.min.css" rel="stylesheet"
        type="text/css" />
    <link rel="stylesheet" type="text/css" href="css/css.css" />
    <style>
       .btn-file
        {
            max-width:320px;  
            margin-left: auto;
            margin-right: auto;  
        }
        #upimgs
        {
            width:100%;
            height: auto;
            max-height: 400px;
        }
        .btn-file
        {
            text-align: center;
            margin-bottom: 10px;
            min-height:200px;
        }
        .Centen
        {
            width: 60%;
            margin: 10px auto 25px auto;
        }
        .Uploadimg
        {
            width: 90%;
            margin: 20px auto 10px auto;
            text-align: center;
            height: 40px;
            line-height: 40px;
            border: #F37B0B 1px solid;
            border-radius: 5px;
            color: #F37B0B;
            font-size: 16px;
        }
    </style>
</head>
<body>
    <div class="wamtop">
        <div class="topleft" onclick="goBack();">
            <img src="img/14.png" />
        </div>
        <div class="topcententxt">
            公众号二维码</div>
    </div>
    <form id="myform">
    <div class="Centen">
        <div>
            <div class="pt10">
                <input name="ad_file" id="ad_file" type="file" multiple="true" />
            </div>
        </div>
        <input type="hidden" id="ewmUrl" value="" />
        <div style="color: #8F8F8F; text-align:center; font-size: 12px;">此图为样本，参照此图上传。 </div>
    </div>
    </form>
    <div class="Uploadimg hide" onclick="update();">
        上传</div>
    <div style="width: 90%; margin: 20px auto 0 auto; color: #8F8F8F; line-height: 22px;">
        <div>
            说明：</div>
        <div>
            1、请从您的订阅号、服务号、企业号中下载您的二维码在此处上传。
        </div>
        <div>
            2、公众号二维码上传后，在您分享出去的文章中会显示。
        </div>
        <br>
    </div>
    <script src="js/jquery-2.1.4.min.js" type="text/javascript"></script>
    <script src="js/jquery-form.js" type="text/javascript"></script>
    <script src="plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
    <script src="plugins/bootstrap-fileinput-master/js/fileinput.min.js" type="text/javascript"></script>
    <script src="plugins/bootstrap-fileinput-master/js/fileinput_locale_zh.js" type="text/javascript"></script>
    <script src="js/jquery-submit.js" type="text/javascript"></script>
    <script src="js/dialog.js" type="text/javascript"></script>
    <script src="js/ajax-upload.js" type="text/javascript"></script>
    <script src="js/ajax-data.js" type="text/javascript"></script>
    <script src="js/base.js" type="text/javascript"></script>
    <script type="text/javascript">
        var logo = "";
        $(function () {
            loadInput();
        });

        function loadInput() {
            var src = "img/Makeimg/gzh.jpg";
            if (getQueryString("src") != null && getQueryString("src") != "" && getQueryString("src") != "null")
                src = getQueryString("src");
            
            $("#ad_file").fileinput({
                showUpload: false,
                showCaption: false,
                showPreview: false,
                browseLabel: '',
                browseClass: "",
                browseIcon: "<img id='upimgs' src='" + src + "' />",
                removeClass: 'hide',
                fileType: "any",
                allowedFileExtensions: ['jpg', 'png', 'gif', 'bmp', 'jpeg']
            });

            //选择了图片提交图片
            $("#ad_file").change(function () {
                if ($(this).val().length == 0) {
                    toast.show("文件格式错误");
                    return;
                }
                wait.show();
                //var urlimg = "Ajax/Upload.ashx?Img&is_cut=1&width=640&height=1000";
                var urlimg = "Ajax/Upload.ashx?Img&is_compress=1&width=320&height=320";

                //上传图片
                $("#myform").ajaxSubmit({
                    type: 'post',
                    dataType: "json",
                    url: urlimg,
                    success: function (data) {
                        wait.dismiss();
                        $("#ad_file").val("");
                        $("#upimgs").attr("src", data.item);
                        $("#ewmUrl").val(data.item);

                        //立即上传
                        update();
                    },
                    error: function (XmlHttpRequest, textStatus, errorThrown) {
                        wait.dismiss();
                        $("#ad_file").val("");
                    }
                });
            });
        }

        //跟新微信二维码
        function update() {
            var ewmUrl = $("#ewmUrl").val();
            if (ewmUrl.length == 0) {
                toast.show("请上传二维码后提交!");
                return;
            }

            //提交数据
            ajaxJson({ url: "Ajax/User.ashx?UpdateInfo", data: { wx_public_code: ewmUrl }, callback: function (data) {
                    Alert('上传成功');
                    setTimeout(function () { goBack(); }, 500)
                }
            });
        }

    </script>
</body>
</html>
